package qiujing.online.response;

/**
 * 生成返回信息工具类
 * Created by 的川 on 2018/5/8.
 */
public class ResultVOUtil {

    public static Result success(){
        Result result = new Result();
        result.setCode(0);
        result.setMsg("成功");
        return result;
    }

    /**
     * 返回成功信息，带具体内容DATA
     * @param object
     * @return
     */
    public static ResultVO success(Object object){
        return success(0,"成功",object);
    }

    /**
     * 返回成功信息
     * @param code
     * @param msg
     * @param object
     * @return
     */
    private static ResultVO success(Integer code , String msg , Object object){
        ResultVO resultVO = new ResultVO();
        resultVO.setCode(code);
        resultVO.setMsg(msg);
        resultVO.setData(object);
        return resultVO;
    }


    /**
     * 返回错误信息
     * @param msg
     * @return
     */
    public static Result error(String msg){
        Result result = new Result();
        result.setCode(1);
        result.setMsg(msg);
        return result;
    }



}
